package com.spotimage.wsn;

import javax.xml.namespace.QName;
import org.w3c.dom.Element;
import org.apache.muse.ws.notification.Filter;
import org.apache.muse.ws.notification.WsnConstants;
import org.apache.muse.ws.notification.impl.FilterFactoryHandler;
import org.apache.muse.ws.notification.topics.WstConstants;
import org.apache.muse.ws.resource.basefaults.BaseFault;


public class TopicListFilterHandler implements FilterFactoryHandler
{
    
	
	public boolean accepts(QName filterName, String filterDialect)
    {
        boolean rightName = filterName.equals(WsnConstants.TOPIC_EXPRESSION_QNAME);
        boolean rightDialect = filterDialect.equals(WstConstants.FULL_TOPIC_URI);
        return rightName && rightDialect;
    }
    
    
    public Filter newInstance(Element filterXML) throws BaseFault
    {
        String dialect = filterXML.getAttribute(WsnConstants.DIALECT);        
        return new TopicListFilter(filterXML, dialect);
    }
}
